#ifndef TCP_SERVER_H
#define TCP_SERVER_H


#ifdef __cplusplus
extern "C" {
#endif

#include "alog.h"

#define TCP_MAX_CONNECTIONS   (100)

struct tcphandler;
struct tcpsrv;


struct tcpsrv* tcpsrv_init(int port, struct tcphandler *phandler, int max_connections, double timeout);
int tcpsrv_stop(struct tcpsrv *server);

int tcpsrv_run_loop(struct tcpsrv *server);// block to start server, for test
int tcpsrv_run(struct tcpsrv *server);	// unblock to start server

// log init/clean
void init_logs(char *logname, ENUM_LOG_LEVEL level, ENUM_LOG_MODE mode);
void uninit_logs();

#ifdef __cplusplus
}
#endif 

#endif //defined(TCP_SERVER_H)
